package org.sidora.core.context;

import java.awt.BasicStroke;
import java.awt.Color;
import java.net.URL;
import java.util.HashSet;

import javax.swing.ImageIcon;
import org.sidora.core.Category;
import org.sidora.core.Variable;


/**
 * DeposedElement
 * @author Enric Tartera, Juan Manuel Gimeno, Roger Masgoret
 * @version 1.0
 */
public class DeposedElement extends Context{
    public Category deposedElement; // vas, esquelet...;
    public Category isolated; //aillat, en conjunt..;
    public Category primary;  //prim�ria, secund�ria;
    
    
    public ImageIcon getIcon() {
        return new javax.swing.ImageIcon(getClass().getResource("/org/sidora/core/context/resources/deposed16.png"));
    }
    
//		public ColorItem getColorItem(){
//			ColorItem colorItem =new ColorItem(	new Color(187,187,88),new Color(105,105,44),
//						new BasicStroke(2.0F,BasicStroke.CAP_ROUND, BasicStroke.CAP_ROUND));
//
//			return colorItem;
//		}
    public String getStringClass() {
        
        return "Deposed";
    }
    
    public HashSet<Variable> getVariableSet() {
        HashSet<Variable> vSet = new HashSet<Variable>();
        String [] labels = {"Element Dipositat", "Posici�","Context"};
        
        for (int i =0 ; i< labels.length; i++){
            Variable var = new Variable();
            var.setLabel(labels[i]);
            var.setReferencedClass(this.getStringClass());
            vSet.add(var);
        }
        return vSet;
        
    }
    public String outputVariables(){
        String dep = "";
        if (deposedElement!=null) dep = deposedElement.getValue();
        String pri = "";
        if (primary!=null) pri = primary.getValue();
        String iso = "";
        if (isolated!=null) iso = isolated.getValue();
        
        StringBuffer buf = new StringBuffer();
        buf.append("<html>");
        buf.append("<body>");
        
        buf.append("<table width=\'100%\' border=\'0\' cellspacing=\'0\' cellpadding=\'1\' bgcolor=\'white\'>");
        buf.append("		<tr align=\'right\'bgcolor=\'#BBBB58\'>");
        buf.append("			<th align=\'right\'><font size=\'3\'color=\'black\' face=\'Lucida\'>Categories:</font></th>");
        buf.append("			<th align=\'left\'></th>");
        buf.append("		</tr>");
        buf.append("		<tr>");
        buf.append("			<td align=\'right\' width=\'25%\'><font size=\'3\'color=\'black\' face=\'Lucida\'><em>Element Dipositat:</em></font></td>");
        buf.append("			<td><font size=\'3\'color=\'black\' face=\'Lucida\'>"+dep+"</font></td>");
        buf.append("		</tr>");
        buf.append("		<tr>");
        buf.append("			<td align=\'right\' width=\'25%\'><font size=\'3\'color=\'black\' face=\'Lucida\'><em>Posici�:</em></font></td>");
        buf.append("			<td><font size=\'3\'color=\'black\' face=\'Lucida\'>"+pri+"</font></td>");
        buf.append("		</tr>");
        buf.append("		<tr>");
        buf.append("			<td align=\'right\' width=\'25%\'><font size=\'3\'color=\'black\' face=\'Lucida\'><em>Context:</em></font></td>");
        buf.append("			<td><font size=\'3\'color=\'black\' face=\'Lucida\'>"+iso+"</font></td>");
        buf.append("		</tr>");
        buf.append("</table>");
        
        
        buf.append("</body>");
        buf.append("</html>");
        
        return buf.toString();
    }
    
    public Category getDeposedElement() {
        return deposedElement;
    }
    
    public void setDeposedElement(Category deposedElement) {
        this.deposedElement = deposedElement;
    }
    
    public Category getIsolated() {
        return isolated;
    }
    
    public void setIsolated(Category isolated) {
        this.isolated = isolated;
    }
    
    public Category getPrimary() {
        return primary;
    }
    
    public void setPrimary(Category primary) {
        this.primary = primary;
    }
}
